package com.ibeeking.gmc.global.g.rest.controller.v1.feign;


import com.ibeeking.gmc.global.api.common.dto.TenantLegalInfoDTO;
import com.ibeeking.gmc.global.api.common.param.TenantLegalInfoParam;
import com.ibeeking.gmc.global.service.common.vo.TenantLegalInfoVO;
import com.ibeeking.nematos.utils.base.BaseValidationGroup;
import com.ibeeking.nematos.utils.bean.BeanUtil;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/g/legalinfo/feign/v1")
public class TenantLegalInfoFeignController {


    @Resource
    private com.ibeeking.gmc.global.g.rest.service.ITenantLegalInfoService ITenantLegalInfoService;

    @PostMapping("/queryLegalInfoByTenantId/{id}")
    public TenantLegalInfoDTO queryLegalInfoByTenantId(@PathVariable("id") Integer id){
        TenantLegalInfoVO vo = this.ITenantLegalInfoService.viewByTenantId(id);
        TenantLegalInfoDTO dto = BeanUtil.convertBean(vo, TenantLegalInfoDTO.class);
        return dto;
    }

    @PostMapping("/modifyLegalInfo")
    public Boolean modifyLegalInfo(@RequestBody @Validated(BaseValidationGroup.Update.class) TenantLegalInfoParam tenantLegalInfoParam) {
        com.ibeeking.gmc.global.service.common.param.TenantLegalInfoParam param = BeanUtil.convertBean(tenantLegalInfoParam, com.ibeeking.gmc.global.service.common.param.TenantLegalInfoParam.class);
        return  ITenantLegalInfoService.save(param);
    }

}
